package com.sfdcj.se.meta.soap;

import com.sforce.soap._2006._04.metadata.CustomField;
import com.sforce.soap._2006._04.metadata.CustomObject;
import com.sforce.soap._2006._04.metadata.DeploymentStatus;
import com.sforce.soap._2006._04.metadata.FieldType;
import com.sforce.soap._2006._04.metadata.SharingModel;

public class CustomObjectCreator {
	
   static  public CustomObject createCustomObject(String label, String fullname) {
        CustomObject co = new CustomObject();
        co.setFullName(fullname);
        co.setDeploymentStatus(DeploymentStatus.Deployed);
        co.setDescription("Created by the Metadata API");
        co.setEnableActivities(true);
        co.setLabel(label);
        co.setPluralLabel(co.getLabel() + "s");
        co.setSharingModel(SharingModel.ReadWrite);
 
        CustomField nf = new CustomField();
        nf.setType(FieldType.Text);
        nf.setDescription("Created by the Metadata API");
        nf.setLabel(label);
        nf.setFullName(fullname);
        // The name field appears in page layouts, related lists, and elsewhere.
        co.setNameField(nf);
        return co;
    }
}